//
//  XDDetViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/8/24.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "XDDetViewController.h"

@interface XDDetViewController (){
    NSMutableArray *array;
}

@end

@implementation XDDetViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setBGColor];
    [self showNav:@"信贷详情"];
    array = [NSMutableArray array];
    [self loadUI];
    [self loadData];
    
}

- (void)loadUI{
    UIScrollView *sclView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64)];
    sclView.contentSize = CGSizeMake(ScreenWidth, ScreenHeight);
    [self.view addSubview:sclView];
    
    UILabel *labBank = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 30, 17)];
    labBank.text = _bank;
    labBank.textAlignment = NSTextAlignmentCenter;
    labBank.textColor = COLOR_RGB(65, 132, 255, 1.0);
    labBank.font = [UIFont systemFontOfSize:11.0];
    labBank.layer.borderWidth = 1.0;
    labBank.layer.borderColor = COLOR_RGB(65, 132, 255, 1.0).CGColor;
    [sclView addSubview:labBank];
    
    UILabel *labTit = [[UILabel alloc] initWithFrame:CGRectMake(55, 16, 200, 17)];
    labTit.text = _tit;
    labTit.font = [UIFont systemFontOfSize:16.0];
    [sclView addSubview:labTit];
    
    UILabel *labDate = [[UILabel alloc] initWithFrame:CGRectMake(16, 45, 100, 17)];
    labDate.text = _date;
    labDate.font = [UIFont systemFontOfSize:13.0];
    labDate.textColor = [UIColor lightGrayColor];
    labDate.font = [UIFont systemFontOfSize:16.0];
    [sclView addSubview:labDate];
    
    UIButton *btnL = [UIButton buttonWithType:UIButtonTypeCustom];
    btnL.frame = CGRectMake(ScreenWidth-60-40, 45, 45, 20);
    [btnL setTitle: _watch forState:UIControlStateNormal];
    [btnL setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    btnL.titleLabel.font = [UIFont systemFontOfSize:12.0];
    [btnL setImage:[UIImage imageNamed:@"浏览2"] forState:UIControlStateNormal];
    [sclView addSubview:btnL];
    
    UIButton *btnR = [UIButton buttonWithType:UIButtonTypeCustom];
    btnR.frame = CGRectMake(ScreenWidth-60, 45, 45, 20);
    [btnR setTitle: _pay forState:UIControlStateNormal];
    [btnR setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    btnR.titleLabel.font = [UIFont systemFontOfSize:12.0];
    [btnR setImage:[UIImage imageNamed:@"费用支付单"] forState:UIControlStateNormal];
    [sclView addSubview:btnR];
    
    UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(16, labDate.frame.origin.y+labDate.frame.size.height+12, ScreenWidth-32, 1)];
    line.backgroundColor = COLOR_RGB(242, 242, 242, 1);
    [sclView addSubview:line];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 160)];
    [imageView sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@"图层-2"]];
    [sclView addSubview:imageView];
    
    
}

//信贷详情
- (void)loadData{
    [SVProgressHUD show];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:@"" forKey:@""];
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    NSString *url = [NSString stringWithFormat:@"%@/App/Credit/details/id/47",urlHead];
    [manager POST:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"res:%@",responseObject);
//        array = [responseObject objectForKey:@"result"];
//        
//        [_tableView reloadData];
        [SVProgressHUD dismiss];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
        [SVProgressHUD dismiss];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
